//商品详情列表
<template>
  <div class="details-good-info">
    <!-- 描述部分 -->
    <div class="describe" v-if="!this.CommonUtils.isEmpty(detailInfo.desc)">{{detailInfo.desc}}</div>
    <!-- 穿着效果 -->
    <div class="effect">{{detailInfo.detailImage&&detailInfo.detailImage[0].key}}</div>
    <!-- 商品图片列表 -->
    <div class="goodlist">
      <img
        @load="loadCom"
        v-for="(item,index) in (detailInfo.detailImage&&detailInfo.detailImage[0].list)"
        :key="index"
        :src="item"
      />
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      //记录图片加载的数量
      count: 0,
      //图片的集合长度
      imgListLength: 0
    };
  },
  created() {},
  methods: {
    //图片加载完成的事件
    loadCom() {
      //图片加载完成之后才通知商品详情页面滚动组件进行刷新
      if (++this.count >= this.imgListLength) {
        // this.$emit("imgLoadComp");
        this.$bus.emit("imgHasLoadCom")
      }
    }
  },
  computed: {},
  components: {},
  props: {
    detailInfo: {
      type: Object,
      default(){
        return {};
      }
    }
  },
  watch: {
    //监听属性
    detailInfo() {
      this.imgListLength = this.detailInfo.detailImage[0].list.length;
    }
  }
};
</script>
<style lang="scss" scoped>
.details-good-info {
  margin-top: 8px;
  font-size: 12px;
  .describe {
    margin: 10px 8px;
    font-weight: bold;
    color: var(--color-glay);
  }
  .effect {
    font-size: 14px;
    font-weight: bold;
    margin: 16px 8px;
  }
  .goodlist {
    img {
      width: 100%;
      object-fit: cover;
    }
  }
}
</style>